<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>Usando jsp:setProperty</TITLE>
<LINK REL=STYLESHEET
      HREF="estilos.css"
      TYPE="text/css">
</HEAD>
<BODY>
<CENTER>
<TABLE BORDER=5>
  <TR><TH CLASS="TITLE">Usando jsp:setProperty</TH>
</TABLE>

<jsp:useBean id="venta" class="beans.Venta" />


<jsp:setProperty 

    name="venta" 
    property="item"
    value='<%= request.getParameter("item") %>' 
    
    
    />

<%
	int c = 0;
	try {
  		c = Integer.parseInt(request.getParameter("cantidad"));
		} catch(NumberFormatException nfe) {}

%>



<jsp:setProperty 

    name="venta" 
    property="cantidad"
    value="<%= c %>" />
    
<% 


double p = 0.0;
try {
  p = Double.parseDouble(request.getParameter("precio"));
} catch(NumberFormatException nfe) {}

%>

<jsp:setProperty 
    name="venta" 
    property="precio"
    value="<%= p %>" 
 
/>
    
<BR>
<TABLE BORDER=1>
<TR CLASS="COLORED">
  <TH>Item <TH>Precio unitario<TH>Cantidad<TH>Precio total
<TR ALIGN="RIGHT">
  <TD><jsp:getProperty name="venta" property="item" />
  <TD>$ <jsp:getProperty name="venta" property="costo" />
  <TD><jsp:getProperty name="venta" property="cantidad" />
  <TD>$ <jsp:getProperty name="venta" property="costoTotal" />
</TABLE>       
</CENTER>
</BODY>
</HTML>